import 'package:flutter/material.dart';
import 'package:xindong/common/xindong_sezhi.dart';
import 'package:xindong/common/xindong_define.dart';
import 'package:xindong/models/xindong_task_class.dart';
import 'package:xindong/res/assets_res.dart';
import 'package:xindong/utils/xindong_image_util.dart';
import 'package:xindong/widgets/common/xindong_round_image.dart';

class XinDongDailyTasksItemWidget extends StatelessWidget {
  final XinDongTaskClass model;
  final Function(XinDongTaskClass model) onTap;

  const XinDongDailyTasksItemWidget({super.key, required this.model, required this.onTap});

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: () => onTap(model),
      behavior: HitTestBehavior.opaque,
      child: Container(
        height: 68,
        color: DZColors.cellColor,
        margin: const EdgeInsets.only(bottom: 1),
        padding: const EdgeInsets.only(left: kPaddingValue, right: kPaddingValue),
        child: Row(
          children: [
            XinDongRoundImage(url: model.iconUrl, size: 40,radius: 40),
            const SizedBox(width: 10),
            Expanded(
              child: Column(
                mainAxisAlignment: MainAxisAlignment.center,
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  Text(
                    model.title,
                    style: const TextStyle(fontSize: 15, color: DZColors.titleColor, height: 1.2),
                  ),
                  const SizedBox(height: 5),
                  Text(
                    "${model.description}",
                    style: const TextStyle(fontSize: 13, color: DZColors.placeholderColor),
                  ),
                ],
              ),
            ),
            Text("${model.msg}", style: const TextStyle(fontSize: 12, color: Colors.red)),
            const SizedBox(width: 2),
            ImageUtil.asset(AssetsRes.ICON_HONGBAO, width: 14, height: 14),
          ],
        ),
      ),
    );
  }
}
